<template>
  <div class="app-container">
    <h1>Generate Config</h1>
    <el-form :model="generateConfig" label-width="150px" label-position="right" :label-position="labelPosition">
      <el-row>
        <el-col :span="8">
          <el-tooltip class="item" effect="dark" content="基础包配置,用于生成package xxx;" placement="top-start">
            <el-form-item label="基础包">
                <el-input v-model="generateConfig.basePackage" style="width: 200px"/>
            </el-form-item>
          </el-tooltip>
        </el-col>
        <el-col :span="8">
          <el-tooltip class="item" effect="dark" content="标注作者信息 @author" placement="top-start">
            <el-form-item label="作者">
              <el-input v-model="generateConfig.author" style="width: 200px"/>
            </el-form-item>
          </el-tooltip>
        </el-col>
        <el-col :span="8">
          <el-tooltip class="item" effect="dark" content="忽略表前缀" placement="top-start">
            <el-form-item label="表前缀">
              <el-input v-model="generateConfig.ignorePrefix" style="width: 200px"/>
          </el-form-item>
          </el-tooltip>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="8">
          <el-form-item label="生成Entity    " >
            <el-switch
              v-model="generateConfig.enableEntity"
              active-color="#13ce66"
              inactive-color="#ff4949"
            />
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-tooltip class="item" effect="dark" content="是否生成Controller控制器，包含增删改查导入导出，此选项选择会默认勾选基础配置" placement="top-start">
            <el-form-item label="生成Controller">
              <el-switch
                v-model="generateConfig.enableController"
                active-color="#13ce66"
                inactive-color="#ff4949"
                />
            </el-form-item>
          </el-tooltip>
        </el-col>
        <el-col :span="8">
          <el-form-item label="生成Service   ">
            <el-switch
              v-model="generateConfig.enableService"
              active-color="#13ce66"
              inactive-color="#ff4949"
              />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="8">
          <el-form-item label="生成Impl      ">
            <el-switch
              v-model="generateConfig.enableServiceImpl"
              active-color="#13ce66"
              inactive-color="#ff4949"
              />
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="生成Mapper    ">
            <el-switch
              v-model="generateConfig.enableMapper"
              active-color="#13ce66"
              inactive-color="#ff4949"
              />
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="生成xml       ">
            <el-switch
              v-model="generateConfig.enableXml"
              active-color="#13ce66"
              inactive-color="#ff4949"
              />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="8">
          <el-tooltip class="item" effect="dark" content="生成vue文件,包括列表新增编辑vue文件、api.js、router配置文件" placement="top-start">
            <el-form-item label="生成Vue       ">
              <el-switch
                v-model="generateConfig.enableVue"
                active-color="#13ce66"
                inactive-color="#ff4949"
                />
            </el-form-item>
          </el-tooltip>
        </el-col>
        <el-col :span="8">
          <el-tooltip class="item" effect="dark" content="生成启动类,配置文件,pom.xml文件等" placement="top-start">
            <el-form-item label="基础配置">
              <el-switch
                v-model="generateConfig.enableBase"
                active-color="#13ce66"
                inactive-color="#ff4949"
              />
            </el-form-item>
          </el-tooltip>
        </el-col>
        <el-col :span="8">
          <el-form-item label="Redis">
            <el-switch
              v-model="generateConfig.enableRedis"
              active-color="#13ce66"
              inactive-color="#ff4949"
            />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="8">
          <el-tooltip class="item" effect="dark" content="调用Lesscoding公共上传服务或上传到本地，暂不可用公共服务整合中" placement="top-start">
            <el-form-item label="文件上传">
              <el-switch
                v-model="generateConfig.enableFile"
                active-color="#13ce66"
                inactive-color="#ff4949"
              />
            </el-form-item>
          </el-tooltip>
        </el-col>
        <el-col :span="8">
          <el-tooltip class="item" effect="dark" content="日志相关注解记录用户操作记录，暂未书写相关模板" placement="top-start">
            <el-form-item label="日志注解">
              <el-switch
                v-model="generateConfig.enableLog"
                active-color="#13ce66"
                inactive-color="#ff4949"
              />
            </el-form-item>
          </el-tooltip>
        </el-col>
        <el-col :span="8">
          <el-tooltip class="item" effect="dark" content="发送邮件相关配置，暂未书写相关模板" placement="top-start">
            <el-form-item label="发送邮件">
              <el-switch
                v-model="generateConfig.enableEmail"
                active-color="#13ce66"
                inactive-color="#ff4949"
                disabled
              />
            </el-form-item>
          </el-tooltip>
        </el-col>

      </el-row>
      <el-row>
        <el-col :span="8">
          <el-tooltip class="item" effect="dark" content="采用Security+Oauth2做权限管理,暂未书写相关模板" placement="top-start">
            <el-form-item label="权限管理">
              <el-switch
                v-model="generateConfig.enableSecurity"
                active-color="#13ce66"
                inactive-color="#ff4949"
                disabled
              />
            </el-form-item>
          </el-tooltip>
        </el-col>
        <el-col :span="8">
          <el-tooltip class="item" effect="dark" content="暂不可用，未书写layui模板" placement="top-start">
            <el-form-item label="生成Layui">
              <el-switch
                v-model="generateConfig.enableLayui"
                active-color="#13ce66"
                inactive-color="#ff4949"
                disabled
              />
            </el-form-item>
          </el-tooltip>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>
<script>
  export default {
    name:'GenerateConfig',
    data(){
      return {
        generateConfig:{
          basePackage:'net.lesscoding',
          author:'eleven',
          enableEntity:true,
          enableController:true,
          enableService:true,
          enableServiceImpl:true,
          enableMapper:true,
          enableXml:true,
          enableVue:true,
          enableLayui:false,
          enableLog:true,
          enableBase:true,
          enableFile:false,
          enableRedis:false,
          enableSecurity:false,
          enableEmail:false,
          ignorePrefix:''
        },
        labelPosition:'left',
    }
    },
    methods: {
    },
    mounted() {

    },
    watch:{
      'generateConfig.enableController':function(newVal,oldVal){
        this.generateConfig.enableBase = newVal
      }
    }
  }
</script>
<style>
  .el-form-item{
    margin-right: 35px;
    margin-bottom: 10px;
    margin-top: 10px;
    width: 400px;

  }
  .item {
    margin: 4px;
  }
</style>
